package com.saycode.portal.user.service.impl;

import com.saycode.common.beans.User;
import com.saycode.common.dao.UserRepository;
import com.saycode.portal.user.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Example;
import org.springframework.stereotype.Service;

/**
 * Created by zhangyanhui on 2017/6/14.
 */
@Service("portal/userService")
public class UserServiceImpl implements UserService {
    @Autowired
    private UserRepository userRepository;

    @Override
    public User findByNameAndPassword(String userName, String password) {
        User user = new User();
        user.setUserName(userName);
        user.setPassword(password);
        return userRepository.findOne(Example.of(user));
    }
}
